This note gives a brief description of the sample printing applications, drivers, and extensions. Detailed explanations of most of these samples are contained within their respective folders.
The samples are, for the most part, written in MPW C 3.3.1. A few of the applications are written in Think C 6.0 and one of the Extensions is built in Metrowerks. All samples have been revised and compiled using the MPW universal interfaces which can be found on this CD. The printer driver samples have been updated to reflect the final shipping versions of the ImageWriter, ImageWriter LQ, and LaserWriter IIsc drivers. A few changes have been made to some of the printing extensions as well.
If you are working on code which is based earlier versions of any of these samples, you should use MPW's “CompareFiles” tool to identify changes.
In order to build some of the MPW code, you will need to edit the line at the top of the makefile so that it points to the “QuickDraw™ GX Libraries:” folder on your hard disk.
Brief Descriptions:
Applications…
• Simple Print
An application that prints a bunch of rotated rectangles. This sample demonstrates the minimal amount of code needed to print from a QuickDraw GX application.
• All Shapes with Printing
This application is a spin-off of the “All Shapes” graphics sample. In addition to printing, this sample also has support for multiple documents.
• Banana Jr.
This application not only has a goofy name, it also has code to handle by-page formatting, multiple documents containing multiple pages, application overrides, and adding panels to dialogs. It’s a good environment for experimenting with GX printing from an application's point of view.
• Getting Started w/GX
This application was used in the "Getting started with QuickDraw GX" session at the 1993 WWDC. It demonstrates how to perform basic graphics and typography operations, as well as how to print the results.
• Experiment no.9
Experiment no.9 is an application which was written to test snippets of QuickDraw GX printing code before rolling them into Inside Macintosh. It grew and grew until it became what it is now-- a heaping helping of basic, intermediate, and advanced QuickDraw GX printing snippets.
• QuickDraw app w/ GX printing
This sample is an example of adding QuickDraw GX printing support to an otherwise non-QuickDraw GX application, making it "QuickDraw GX Aware." The application still draws using QuickDraw commands. If you're interested in updating your old applications to QuickDraw GX, take a look at this sample. This code is part of an upcoming article in issue #19 of develop magazine.
Extensions…
• Additions
This is the source code for the Additions printing extension. This extension allows you to change the appearance of printed pages in various ways.
• Back2Front
This printing extension allows you to print pages in reverse order.
• Backwash
Backwash allows you to select a PICT file which will be translated into a QuickDraw GX shape and then used as a backdrop on each printed page. Now builds under MPW or Metrowerks. It provides a good example of how to store driver global in the Message Handler Instance Context.
• Confidential
This printing extension adds a text stamp on each page printed--you specify the text and font size. Now builds under MPW or Metrowerks.
• Spooling
This printing extension lets you redirect spool files to another volume, either connected to your Mac or across a network. QuickDraw GX normally spools all documents to your boot volume. If you don’t have much space available on your boot volume, use this extension to spool to another.
• Extension Shell
This printing extension is an excellent shell to build from whenever you need to write a new QuickDraw GX printing extension. It contains resources and code for initializing an A5 world (so you can use global data), adding a panel to a dialog, and performing a simple override. Since so much of the code and resources stay the same from printing extension to printing extension, this shell can save you loads of time. If you build and install the extension as it is, It will make your Macintosh beep every time a page is spooled to disk. Very annoying, but a good example of how to create a simple override.
• Extension Shell - multi-seg
Same as above, but this one shows how to break up one override over several code segments using the GXPRINTINGDISPATCH macro.
• PostScript Extension Shell
This is a modified version of the "Extension Shell." This sample overrides a PostScript imaging message to beep whenever your Macintosh starts to send a page to the printer. You need to set up your override resources slightly differently when you override imaging system specific (PostScript, raster, or vector) messages. This sample shows you what to do. Naturally, this printing extension only functions with PostScript printer drivers.
• UserAlert
This printing extension demonstrates how you can invoke QuickDraw GX printing alerts from your extensions and drivers. It adds a "Show an Alert…" item to the Finder's desktop printer menu, and also displays an alert at when it despools pages.
• UserItems
Although QuickDraw GX provides several types of panel controls, sometimes your needs require a bit more flexibility. With the Dialog Manager, an easy solution to this problem is to create userItems. Not suprisingly, we've seen developers try to use that approach with their GX print panels. Unfortunately, for reasons explained in the "About UserItems…" file, you must do some extra work to support userItems within a print panel. This sample shows you how to make your panel's userItems work within the QuickDraw GX messaging system.
• Kabooms…
These two printing extensions (and the documentation that accompany them) illustrate a potential problem when using global data in a printing extension or printer driver. Of course, a work-around is also provided.
Printer Drivers…
• Generic LaserWriter
• ImageWriter
• ImageWriterLQ (alt. rdip)
• LaserWriterIIsc (New GX v1.1)
• HPXL
• CustomWriter GX
• Scanning Generic LaserWriter
• Generic LW "30 sec Alert"
• LaserWriter--custom dialogs
• ImageWriter--Chooser snooper
• ImageWriter--custom dialogs
• ImageWriter--DTP renamer
Sample code for various printer drivers. See the enclosed readme for more information on each driver
• Printer Status Routines -
This file contains sample routines for handling status dialogs in a printer driver. It demonstrates how to display status strings in a desktop printer window, and how to conduct various user alerts.
TranslateQDShape…
This file contains sample routines for parsing “QuickDraw PICT” shapes which are written into print files when non-QuickDraw GX applications print. For more information, see the accompanying documentation: “About the QuickDraw PICT shape.”
We'd really like to know if these samples are useful to you, or more useful than previous versions. You can reach us at DEVSUPPORT on AppleLink with comments and suggestions.